[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
  Function            intlen - calculate length of integer in a string

  Syntax              int intlen(char *number);

  Prototype in        stringhk.h

  Remarks             intlen calculates the length of an integer in the
                      string number. The integer is terminated by a
                      non-digit (any character other than 0-9.) This
                      function is used internally by strcomma.

  Return value        the length of the integer pointed to by number.

  Example             #include <stringhk.h>
                      #include <stdio.h>            /* for the printf */
                      #include <alloc.h>            /* for the calloc */

                      main()
                      {
                           char *sint[15];
                           int len;

                           strcpy(sint,"1839.44");
                           printf("String: %s    Length of integer: %d\n"
                                  , sint, intlen(sint));
                           strcpy(sint,"19,848");
                           printf("String: %s    Length of integer: %d\n"
                                  , sint, intlen(sint));
                           strcpy(sint,"44x993");
                           printf("String: %s    Length of integer: %d\n"
                                  , sint, intlen(sint));
                      }

  Program output      String: 1839.44    Length of integer: 4
                      String: 19,848    Length of integer: 2
                      String: 44x993    Length of integer: 2


This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson